//
//  SurpriseShopTextCell.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/11.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit
import SDCycleScrollView

class SurpriseShopTextCell: BaseTableViewCell {
    @IBOutlet weak var bgView: UIView!
    
    @IBOutlet weak var textBgView: UIView!
    
    
    lazy var cycleScrollView : SDCycleScrollView = {
        
        let temp = SDCycleScrollView(frame:CGRect(x: 0, y: 0, width: KScreenW - 114, height: 36) , delegate: nil, placeholderImage: UIImage(named: "placeholder"))
        
        temp?.titleLabelBackgroundColor = UIColor.white
        
        temp?.titleLabelTextColor = UIColor.black
        
        temp?.scrollDirection = .vertical
        
        temp?.onlyDisplayText = true
        
        return temp!
        
    }()
    
    
    var headList : [SurpriseHeadLineModel]?{
    
        didSet{
        
            if headList == nil {
                return
            }
            
            
            if headList!.count > 0 {
                var arry = [String]()
                for item in headList! {
                    arry.append(item.text)
                }
                
                cycleScrollView.titlesGroup = arry
            }
            
        
        }
    
    
    
    }



    override func awakeFromNib() {
        super.awakeFromNib()
        contentView.backgroundColor = UIColor.viewBgGrey()
        
        bgView.addCornerAndBorder(borderColor: nil, borderWidth: 0, masksToBounds: true, cornerRadius: 5)
        
        textBgView.addSubview(cycleScrollView)

        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
